
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>数据库后台</title>
    <link href="../css/bootstrap.min.css" rel="stylesheet" />
    <link href="../css/custom.css" rel="stylesheet" />
    <script src="../js/jquery-1.7.1.min.js"></script>
    <script src="../js/bootstrap.min.js"></script>
    <script src="../js/jquery.js"></script>
    <script type="text/javascript" src="../js/bootstrap.min.js" charset="UTF-8"></script>
    <script src="../js/jquery.form.js"></script>
</head>

<body>
<div id="wrapper">
    <nav class="navbar navbar-default navbar-cls-top " role="navigation"
         style="margin-bottom: 0">
        <div class="navbar-header">
            <a class="navbar-brand">表单录入</a>
        </div>
        <div
                style="color: white; padding: 15px 50px 5px 50px; float: right; font-size: 16px;">
            <button id = "loginout" class="btn btn-danger">注销</button>
        </div>
    </nav>
    <!-- /. NAV TOP  -->
    <nav class="navbar-default navbar-side" role="navigation">
        <div class="sidebar-collapse">
            <ul class="nav" id="main-menu">
                <li><a href="wenzhang.html"><i class="fa fa-qrcode fa-3x"></i>文章添加</a></li>
                <li><a href="wenzhangchaxun.html"><i class="fa fa-bar-chart-o fa-3x"></i> 文章管理</a></li>
            </ul>
        </div>
    </nav>
    <!-- /. NAV SIDE  -->
    <div id="page-wrapper">
        <div id="page-inner">
            <div class="container">
                <fieldset>
                    <legend>文章添加</legend>
                    <div class="modal-body">标题
                        <input id="title" type="text"  />
                    </div>
                    <div class="modal-body">文章
                        <textarea id="mainbody" style="width: 1300px;height: 600px"></textarea>
                    </div>
                    <div class="modal-body">
                        <input type="button" id="modify" class="btn btn-primary" value="新增数据" />
                    </div>
                </fieldset>
            </div>
            <!-- /. PAGE INNER  -->
        </div>
        <!-- /. PAGE WRAPPER  -->
    </div>
</div>
    <script type="text/javascript">
        $(document).ready(function () {

            $("#modify").click(function () {
                let d1 = {
                    title:$("#title").val(),
                    mainbody:$("#mainbody").val(),
                };
                $.ajax({
                    type: "POST",
                    url: "../addArticle",
                    contentType: "application/json;charset=utf-8",
                    data: JSON.stringify(d1),
                    dataType: "text",
                    success: function (data) {
                        alert(data)
                        // $("#searchlist").click();
                        // $('#myModal').dialog('close');
                    },
                    error: function (data) {
                        window.location.href = "/msgtable/html/login.html"
                        alert("请登录")
                    }
                });
            });
        })
    </script>

</body>
</html>